package com.totoro.rpc.register;

import com.totoro.rpc.common.util.StringUtils;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

/**
 * Created by Niki on 2018/5/8 19:05
 */
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class ZookeeperUtil {
    private static final String DEF_VERSION = "DEF_VERSION";

    protected static String serverPath(String serverPath, String version) {
        if (StringUtils.isBlank(version)) {
            version = DEF_VERSION;
        }
        return "/" + ZookeeperConfig.getRootPath() + "/" + ZookeeperConfig.getZk_regis_path() + "/" + serverPath + "/" + "server" + "/" + version ;
    }

    protected static String clientPath(String serverPath) {
        return "/" + ZookeeperConfig.getRootPath() + "/" + ZookeeperConfig.getZk_regis_path() + "/" + serverPath + "/" + "client";
    }
}
